<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page language="java" contentType="text/html; charset=UTF-8"
		 pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
	<meta http-equiv="Content-Type" content="multipart/form-data; charset=utf-8" />

	<meta name="viewport" content="width=device-width, initial-scale=1">
	<!-- 上述3个meta标签*必须*放在最前面，任何其他内容都*必须*跟随其后！ -->
	<meta name="description" content="">
	<meta name="author" content="">

	<title>发布信息</title>

	<!-- 新 Bootstrap 核心 CSS 文件 -->
	<link
			href="https://cdn.bootcss.com/bootstrap/3.3.7/css/bootstrap.min.css"
			rel="stylesheet">

	<!-- jQuery文件。务必在bootstrap.min.js 之前引入 -->
	<script src="https://cdn.bootcss.com/jquery/2.1.1/jquery.min.js"></script>




</head>

<body>


<%@include file="navbar.jsp"%>

<%--返回错误信息--%>
<%
	String s = (String)request.getAttribute("error");
	if (s!=null){%>
<div class="alert alert-warning" style="margin-top: 50px">
	<a href="#" class="close" data-dismiss="alert">
		&times;
	</a>
	<%=s%>
</div>
<%}%>



<!--margin:0px auto; 左右居中-->
<div class="container-fluid" style="max-width: 60%; padding-top: 40px;">

	<div class="page-header">
		<h1>完善信息</h1>
	</div>


	<form class="form-horizontal" action="UpdatePublish?gid=${Goods_Info_p.goods_id}" name="form" onsubmit="return beforeSubmit();"
		  method="post" enctype="multipart/form-data">
		<div class="form-group">
			<label class="col-sm-2 control-label">商品类别</label>
			<div class="col-sm-10">
				<select  name="type_id"
						 class="selectpicker show-tick form-control">
					<c:forEach items="${Alltype}" var="type">
						<c:if test="${Goods_Info_p.type_id} eq ${type.type_id}" >
							<c:set var="sel" value="selected"></c:set>
						</c:if>
						<c:if test="${Goods_Info_p.type_id} ne ${type.type_id}" >
							<c:set var="sel" value=""></c:set>
						</c:if>
						<option value="${type.type_id}"  selected="${sel}">${type.type_name}</option>

					</c:forEach>
				</select>
			</div>
		</div>

		<div class="form-group">
			<label class="col-sm-2 control-label">新旧程度</label>
			<div class="col-sm-10">
				<select name="old_level"
						class="selectpicker show-tick form-control">
					<c:forEach items="${Alllevel}" var="level" varStatus="status">
						<c:if test="${Goods_Info_p.oldLevel} == ${level.old_level}" >
							<c:set var="sel" value="selected"></c:set>
						</c:if>
						<option value="${level.old_level}" selected="${sel}">${level.old_des}</option>
					</c:forEach>

				</select>
			</div>
		</div>

		<div class="form-group">
			<label class="col-sm-2 control-label">商品价格</label>
			<div class="col-sm-10">
				<input type="text" class="form-control" name="goods_price" value="${Goods_Info_p.goods_price}" required>
			</div>
		</div>
		<div class="form-group">
			<label  class="col-sm-2 control-label">商品标题</label>
			<div class="col-sm-10">
				<input type="text" class="form-control" name="goods_name" value="${Goods_Info_p.goods_name}" required>
			</div>
		</div>
		<div class="form-group">
			<label class="col-sm-2 control-label">商品介绍</label>
			<div class="col-sm-10">
				<textarea class="form-control" rows="3" name="goods_describe"  required >
					${Goods_Info_p.goods_describe}
				</textarea>
			</div>
		</div>

		<div class="form-group">
			<label  class="col-sm-2 control-label" required>交易地点</label>
			<div class="col-sm-10">
				<input type="text" class="form-control" name="trade_place"  value="${Goods_Info_p.trade_place}" required>
			</div>
		</div>

		<%--图片只显示，不改--%>
		<div class="form-group">
			<label class="col-sm-2 control-label">上传图片</label>
			<div class="col-sm-10">
				<div class="panel panel-default ">
					<div class="panel-heading">选择上传图片</div>
					<div class="panel-body">

						<c:if test="${Goods_Info_p.goods_img.substring(0,1) eq '/'}">
							<img id="goodsPic"  class=" img-responsive " alt="img"
								  src="${Goods_Info_p.goods_img}" width="200px" height="200px">
						</c:if>

						<c:if test="${Goods_Info_p.goods_img.substring(0,1) ne '/'}">
							<img id="goodsPic" src="showGoodsPic?goodsImg=${Goods_Info_p.goods_img}&userid=${Goods_Info_p.user.userid}"
								 class=" img-responsive " alt="img" width="200px" height="200px">
						</c:if>

						<%--<img id="goodsPic" src="/market/images/image.png"  width="200px" height="200px" style="padding: 5px">--%>
						<%--<input id="goodsPicUp" name="pic_file" accept="image/*" type="file" style="display: none" />--%>

					</div>
				</div>
			</div>
		</div>

		<h4>
			<b>联系方式</b>
		</h4>
		<div class="form-group">
			<label class="col-sm-2  control-label">联系人</label>
			<div class="col-sm-10">
				<input type="text" class="form-control" name="contact_name"  value="${Goods_Info_p.contact_name}" required>
			</div>
		</div>

		<div class="form-group">
			<label class="col-sm-2 control-label">联系电话</label>
			<div class="col-sm-10">
				<input type="text" class="form-control" name="telephone"  value="${Goods_Info_p.telephone}" required>
			</div>
		</div>

		<div class="form-group">
			<label class="col-sm-2 control-label">QQ/微信</label>
			<div class="col-sm-10">
				<input type="text" class="form-control" id="qq_number" name="qq_number" value="${Goods_Info_p.qq_number}">
			</div>
		</div>


		<div class="form-group">
			<label class="col-sm-2 control-label"></label>
			<div class="col-sm-10">
				<button  class="btn  btn-primary btn-block" type="submit">保存修改</button>

			</div>
		</div>



	</form>


</div>
<!-- 最新的 Bootstrap 核心 JavaScript 文件 -->
<script src="https://cdn.bootcss.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<script src="/market/js/common.js"></script>
</body>
</html>